{% extends 'base.html' %}
{% load static %}
{% block content %}
<div class="row justify-content-center mt-5">
    <div class="col-md-6">
        <div class="card">
            <div class="card-header bg-success text-white">
                <h3 class="card-title text-center">注册</h3>
            </div>
            <div class="card-body">
                <form method="post">
                    {% csrf_token %}
                    <div class="mb-3">
                        <label for="username" class="form-label">用户名</label>
                        <input type="text" class="form-control" id="username" name="username" required>
                    </div>
                    <div class="mb-3">
                        <label for="phone_number" class="form-label">手机号</label>
                        <input type="text" class="form-control" id="phone_number" name="phone_number" required>
                    </div>
                    <div class="mb-3">
                        <label for="password1" class="form-label">密码</label>
                        <input type="password" class="form-control" id="password1" name="password1" required>
                    </div>
                    <div class="mb-3">
                        <label for="password2" class="form-label">确认密码</label>
                        <input type="password" class="form-control" id="password2" name="password2" required>
                    </div>
                    <button type="submit" class="btn btn-success w-100">注册</button>
                </form>
                {% if form.errors %}
                <div class="alert alert-danger mt-3">
                    {% for field, errors in form.errors.items %}
                        {% for error in errors %}
                            {{ error }}<br>
                        {% endfor %}
                    {% endfor %}
                </div>
                {% endif %}
            </div>
            <div class="card-footer text-center">
                <a href="{% url 'login' %}" class="text-decoration-none">已有账号？立即登录</a>
            </div>
        </div>
    </div>
</div>
{% endblock %}